﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Upreader.Application.Model;

namespace Upreader.Application
{
    public static class ModelsChangedEventArgsFactory
    {
        public static ModelsChangedEventArgs FromSingle(int id, ModelState state)
        {
            return new ModelsChangedEventArgs(new ModelEntry[] { new ModelEntry(id, state) });
        }

        public static ModelsChangedEventArgs FromMultiple(IEnumerable<int> idSet, ModelState modelState)
        {
            if (idSet == null)
                throw new ArgumentNullException("idSet");

            var entries = idSet.Select(x => new ModelEntry(x, modelState));

            return new ModelsChangedEventArgs(entries);
        }
    }
}
